package com.achievo.know.web.component;

import java.io.FileInputStream;
import java.io.InputStream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ResourceUtils;

import com.achievo.know.application.FileApplication;
import com.achievo.know.component.impl.FileManagerConfig;
import com.opensymphony.xwork2.ActionSupport;

public class PreviewAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 577153791960486157L;
	
	private String fileName;
	
	private Long id;
	
	private String contentType;
	
	@Autowired
	private FileApplication fileApplication;
	@Autowired
    private FileManagerConfig config;
	
	private String swfPath;


	public InputStream getDownloadFile() throws Exception {  
		this.fileName = "paper.swf";
		//String path=config.getPersistFileStoreDirectory()+File.separator+atts.getAttachPath()+atts.getGuid()+".swf";
        return new FileInputStream(ResourceUtils.getFile(swfPath));
    }  
  
    @Override  
    public String execute() throws Exception {  
        return SUCCESS;  
    }

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public FileApplication getFileApplication() {
		return fileApplication;
	}

	public void setFileApplication(FileApplication fileApplication) {
		this.fileApplication = fileApplication;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public FileManagerConfig getConfig() {
		return config;
	}

	public void setConfig(FileManagerConfig config) {
		this.config = config;
	}

	public String getSwfPath() {
		return swfPath;
	}

	public void setSwfPath(String swfPath) {
		this.swfPath = swfPath;
	}

	
	
    
}
